package com.songshu.sca.controller;

import com.songshu.sca.nacosConfig.NacosConfig1Test;
import com.songshu.sca.nacosConfig.NacosConfigTest;
import com.songshu.sca.nacosConfig.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class NacosConfigTestController {

    @Autowired
    private NacosConfigTest nacosConfigTest;

    @Autowired
    private NacosConfig1Test nacosConfig1Test;

    @Autowired
    private User user;

    @GetMapping(value = "nacostest")
    public String testNacos(){
        String s = nacosConfigTest.toString();
        log.info("nacostest: {}", s);
        return s;
    }

    @GetMapping(value = "nacostest1")
    public String testNacos1(){
        String s = nacosConfig1Test.toString();
        log.info("nacostest1: {}", s);
        return s;
    }


    @RequestMapping("/user")
    public String user() {
        log.info("user: {}", user);
        return "[HTTP] " + user;
    }

}
